/**
 * Copyright &copy; 2016-2017 <a href="http://git.oschina.net/whoamien/backend_management">Backend Management</a> All rights reserved.
 */
package com.xw.framework.base.service;

import java.io.Serializable;
import java.util.List;

import org.springframework.data.domain.Page;

import com.xw.framework.base.page.BaseQuery;

/**
 * The Interface BaseService.
 *
 * @author Xi Wei
 * @param <E> the element type
 * @param <PK> the generic type
 */
public interface BaseService<E,PK extends Serializable> {

	/**
	 * Save.
	 *
	 * @param entity the entity
	 * @return the e
	 */
	public E save(E entity);
	
	/**
	 * Delete.
	 *
	 * @param id the id
	 */
	public void delete(PK id);

	/**
	 * Find page.
	 *
	 * @param query the query
	 * @return the page
	 */
	public Page<E> findPage(BaseQuery query);

	/**
	 * Gets the by id.
	 *
	 * @param pk the pk
	 * @return the by id
	 */
	public E getById(PK pk);
	
	/**
	 * Find all.
	 *
	 * @return the list
	 */
	public List<E> findAll();
	
}
